public static String[] arrMenuYN={"YES","NO"};
void UpdateExit(int mode)
{
		if(mode ==  UpdateType.UPDATE)
		{   
		    if (IsKeyPressed(GK_DOWN)) {
			//m_SprConvatchuyendong.setFrameSequence(arrSequenceDown);
			if (++s_icurrentMenuPos > 1) s_icurrentMenuPos = 0;
		    }
		    else if (IsKeyPressed(GK_UP)) {
			//m_SprConvatchuyendong.setFrameSequence(arrSequenceUp);
			if (--s_icurrentMenuPos < 0) s_icurrentMenuPos = 1;
		    }
		    
			if((IsKeyPressed(DK_SOFT_LEFT)||IsKeyPressed(GK_SELECT))&& s_icurrentMenuPos==0)
			{
				DemoMIDlet._theMIDlet.destroyApp(true);
			}
			if(IsKeyPressed(DK_SOFT_RIGHT)&&!isIGMenu)
			{
				SwitchState(GameState.MainMenu);
			}
			if(IsKeyPressed(DK_SOFT_RIGHT)&&isIGMenu)
			{
				SwitchState(GameState.InGameMenu);
			}
			if((IsKeyPressed(DK_SOFT_LEFT)||IsKeyPressed(GK_SELECT))&& s_icurrentMenuPos==1&&!isIGMenu)
			{
				SwitchState(GameState.MainMenu);
			}
			if((IsKeyPressed(DK_SOFT_LEFT)||IsKeyPressed(GK_SELECT))&& s_icurrentMenuPos==1&&isIGMenu)
			{
				SwitchState(GameState.InGameMenu);
			}
		}
		
		if(mode == UpdateType.PAINT)
		{
			// s_g.setColor(c_black);
			// s_g.fillRect(0,0,240,320);
			// s_g.setColor(c_white);
			if (m_imgOptionBG != null)
		   {
			s_g.drawImage(m_imgOptionBG, 0, 0, Graphics.TOP|Graphics.LEFT);
		   }
			fonts[1].drawString("DO YOU WANT TO EXIT?",SCREEN_W>>1,50,Graphics.HCENTER,s_g);
			// drawString(s_g, "YES", 1, SCREEN_W/3, SCREEN_H/2, 1);
			// drawString(s_g, "NO", 1, 2*SCREEN_W/3, SCREEN_H/2, 1);
			for (iItem = 0; iItem < 2; iItem++) {
			if(iItem==s_icurrentMenuPos)
			fonts[1].drawString(arrMenuYN[iItem],SCREEN_W>>1,100 + 43 * iItem,Graphics.HCENTER,s_g);
			else fonts[2].drawString(arrMenuYN[iItem],SCREEN_W>>1,100 + 43 * iItem,Graphics.HCENTER,s_g);
		    }
		    int titleW=0;
		    for (int i = 0; i < 3; i++)
		    {
		    titleW = fonts[1].stringWidth(arrMenuYN[s_icurrentMenuPos]);
			sprArrow.paintAnim(s_g, 0, s_frameCount, (SCREEN_W>>1)
					+ (titleW >> 1) + 3, 102+43*s_icurrentMenuPos);
			sprArrow.paintAnim(s_g, 1, s_frameCount, (SCREEN_W>>1)
					- (titleW >> 1) - 17, 102+43*s_icurrentMenuPos);
		    }
			
		}
		
		if(mode == UpdateType.CTOR)
		{
			s_icurrentMenuPos=1;
			try{
			m_imgOptionBG = Image.createImage("/bg_pink_02.png");	
			sprArrow = new XSprite("/arrow.png", 12, 16, new byte[][] {
				{ 0, 1, 2, 1 }, { 3, 4, 5, 4 } });
			}
			catch(Exception e){}
		}
		if(mode == UpdateType.DTOR)
		{
		s_keyPressed=0;
		sprArrow=null;
		m_imgOptionBG=null;
		}
}